package com.taoyige.ui;

import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.widget.ImageButton;
import android.widget.TextView;

import com.taoyige.R;
import com.taoyige.common.UIHelper;

/**
 * 联系客服
 * @author 刘宁
 *
 */
public class ConsulationActivity extends BaseActivity {
	
	private TextView userHeadText;
	private ImageButton returnBack,homePage;
	
	private String  url = "https://meiqia.com/chat/3642";
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.consulation);
		WebView webview = (WebView)findViewById(R.id.webview);
		WebSettings settings = webview.getSettings();
		settings.setJavaScriptEnabled(true); // 允许页面使用javascript
		webview.loadUrl(url);
		initView();
	}	
	
	private void initView(){
		returnBack=(ImageButton)findViewById(R.id.user_hear_return_back);
		homePage=(ImageButton)findViewById(R.id.user_hear_homePage);
		returnBack.setOnClickListener(userCenterListener);
		homePage.setOnClickListener(homeListener);
		
		userHeadText=(TextView)findViewById(R.id.user_hear_text);
		userHeadText.setText("在线咨询");
	}	
	
	private View.OnClickListener homeListener = new View.OnClickListener() {
		@Override
		public void onClick(View v) {
			UIHelper.showHomePage(v.getContext());
		}
	};
	
	private View.OnClickListener userCenterListener = new View.OnClickListener() {
		
		@Override
		public void onClick(View v) {
			UIHelper.showUser(v.getContext());
		}
	};
	
	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		return false;
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		int id = item.getItemId();
		if (id == R.id.action_settings) {
			return true;
		}
		return super.onOptionsItemSelected(item);
	}
}
